home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pcv05n11.zip / TODAYS.BAS < prev    next >
BASIC Source File  |  1993-06-02  |  4KB  |  100 lines

  1. DECLARE SUB TodaysFiles ()
  2. COMMON SHARED CurDrv$, CurPath$, Today$, DestDrive$
  3. Today$ = LEFT$(DATE$, 6) + RIGHT$(DATE$, 2) 'Today's date in DIR form
  4.  
  5. DestDrive$ = "A:"          'Current target drive. Change string to
  6.                            'change the target drive
  7.  
  8. FOR NumOfDrives% = 1 TO 2  'To change # of drives to check, change number
  9. READ CurDrv$               'here and modify DATA statement at the end
  10.  
  11. SHELL "cd " + CurDrv$ + "\"  'Change directory of hard disk to root
  12. SHELL "tree " + CurDrv$ + "\ > c:\alldirs.txt" 'Put output of TREE in a file
  13.  
  14. WorkFile$ = "c:\alldirs.txt"        'Establish variable for filename
  15. OPEN WorkFile$ FOR INPUT AS #1      'Open the file for reading
  16.  
  17. LINE INPUT #1, TreeLine$            'Strip off the first two lines of the
  18. LINE INPUT #1, TreeLine$            'file containing the TREE output
  19.  
  20. CLS : CurPath$ = CurDrv$: TodaysFiles  'Process root directory first
  21.  
  22. DO WHILE NOT EOF(1)                 'Read until end-of-file reached
  23.     LINE INPUT #1, TreeLine$        'Get next line of the file
  24.     Ptr% = 0                        'Control variable for IF statements
  25.    
  26.     FOR Indent% = 1 TO LEN(TreeLine$)
  27.         Temp% = ASC(MID$(TreeLine$, Indent%, 1))
  28.             IF Temp% > 32 AND Temp% < 127 THEN
  29.             Ptr% = Indent%: EXIT FOR
  30.         END IF
  31.     NEXT Indent%
  32.  
  33.     IF Ptr% = 5 THEN                'Root-level directory
  34.         Root$ = MID$(TreeLine$, 5, LEN(TreeLine$))
  35.         CurPath$ = CurDrv$ + "\" + Root$
  36.         TodaysFiles
  37.     ELSEIF Ptr% = 9 THEN            'Level 2 directory
  38.         ThisDir$ = MID$(TreeLine$, 9, LEN(TreeLine$))
  39.         Level2$ = CurDrv$ + "\" + Root$ + "\" + ThisDir$
  40.         CurPath$ = Level2$: TodaysFiles
  41.     ELSEIF Ptr% = 13 THEN           'Level 3 directory
  42.         ThisDir$ = MID$(TreeLine$, 13, LEN(TreeLine$))
  43.         Level3$ = Level2$ + "\" + ThisDir$
  44.         CurPath$ = Level3$: TodaysFiles
  45.     ELSEIF Ptr% = 17 THEN           'Level 4 directory
  46.         ThisDir$ = MID$(TreeLine$, 17, LEN(TreeLine$))
  47.         Level4$ = Level3$ + "\" + ThisDir$
  48.         CurPath$ = Level4$: TodaysFiles
  49.     ELSEIF Ptr% = 21 THEN           'Level 5 directory
  50.         ThisDir$ = MID$(TreeLine$, 21, LEN(TreeLine$))
  51.         Level5$ = Level4$ + "\" + ThisDir$
  52.         CurPath$ = Level5$: TodaysFiles
  53.     END IF
  54.  
  55. LOOP
  56. CLOSE #1
  57. KILL WorkFile$
  58. NEXT NumOfDrives%
  59. DATA "C:", "F:"
  60. CLS : SYSTEM
  61.  
  62. SUB TodaysFiles
  63.     DOSCmd$ = "dir " + CurPath$ + " /-P > c:\tempfile.xxx"
  64.     SHELL DOSCmd$
  65.     TempFile$ = "c:\tempfile.xxx"
  66.     OPEN TempFile$ FOR INPUT AS #2
  67.     DO WHILE NOT EOF(2)
  68.         LINE INPUT #2, DirEntry$
  69.         IF MID$(DirEntry$, 24, 8) = Today$ THEN
  70.             Ext$ = MID$(DirEntry$, 10, 3)
  71.             '*** The following line specifies which files to find ***
  72.             IF Ext$ = "ed" OR Ext$ = "ed1" OR Ext$ = "raw" THEN
  73.                 Filename$ = RTRIM$(LEFT$(DirEntry$, 8))
  74.                 CLS : LOCATE 13: PRINT CHR$(7)
  75.                 PRINT "Press Y to copy ";
  76.                 PRINT CurPath$ + "\" + Filename$ + "." + Ext$;
  77.                 PRINT " or press N to go on"
  78.                 DO: Reply$ = INKEY$
  79.                 LOOP UNTIL UCASE$(Reply$) = "Y" OR UCASE$(Reply$) = "N"
  80.                 IF UCASE$(Reply$) = "Y" THEN
  81.                     IF LEN(CurPath$) > 2 THEN
  82.                         SHELL "md " + DestDrive$ + MID$(CurPath$, 3)
  83.                         Flag% = 1
  84.                     END IF
  85.                     CmdLine$ = "copy " + CurPath$ + "\" + Filename$
  86.                     CmdLine$ = CmdLine$ + "." + Ext$ + " " + DestDrive$
  87.                     IF Flag% = 1 THEN
  88.                         CmdLine$ = CmdLine$ + MID$(CurPath$, 3): Flag% = 0
  89.                     END IF
  90.                     SHELL CmdLine$
  91.                 END IF
  92.             END IF
  93.         END IF
  94.     LOOP
  95. CLOSE #2
  96. KILL TempFile$
  97.  
  98. END SUB
  99.  
  100.